package org.eda.act1;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class GuardarFichero {
	
	private static File guardarEnFichero(){
		File outFile = new File("C:/2011-Ward-candidates-list-texto-ordenado.txt");
	return outFile;
	}

	public static void guardarDatos(String[] aR, int J){
		File outFile = guardarEnFichero();
		FileWriter fw = null;
		BufferedWriter writer = null;
		try{
			fw = new FileWriter(outFile,false);
			writer = new BufferedWriter(fw);
			int i=0;
			
				while(i<J){
					writer.write(aR[i]);
					writer.newLine();
					i=i+1;
				}
		}catch (IOException e){
			System.err.println(e);
		}finally{
			try {
				if (null != fw){ 
				writer.close();}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		
	}
}
